package global

import (
	"github.com/go-redis/redis"
	"time"
)

var RedisDB *redis.Client

// CacheDuration cache的过期时长
const CacheDuration = time.Minute * 1

// SetupRedisDB 创建连接
func SetupRedisDB() error {
	RedisDB = redis.NewClient(&redis.Options{
		Addr:     RedisSetting.Address,
		Password: RedisSetting.Password,
		DB:       0,
	})
	_, err := RedisDB.Ping().Result()
	if err != nil {
		return err
	}
	return nil
}
